export default async function ajax(
  url: string,
  method: string = "get",
  params?: any
) {
  let baseUrl = "http://152.136.162.68:3001";
  return new Promise((resolve, reject) => {
    fetch(`${baseUrl}${url}`, {
      method: method,
      body: params,
      headers: {
        "Content-Type": "application/json",
      },
    })
      .then((res) => res.json())
      .then((res) => {
        resolve(res);
      });
  });
}
